package cn.fz.mpdemo.exception;

import cn.fz.mpdemo.domain.vo.CodeEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

@ResponseStatus(value = HttpStatus.OK, reason = "业务层异常")
@Data
@EqualsAndHashCode(callSuper = true)
public class BizException extends RuntimeException{
    private String code;

    private String message;

    public BizException() {
    }

    public BizException(String message) {
        this("1", message);
    }

    public BizException(CodeEnum codeEnum) {
        this(codeEnum.code, codeEnum.message);
    }

    public BizException(String code, String message) {
        this.code = code;
        this.message = message;
    }
}
